<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 100px;
            height: 100px;
            background-color: red;
        }
    </style>
</head>
<body>
    <button>1</button>
    <div class="box"></div>
    <script>
        // let btn=document.querySelector("button")
        //点击事件
        //事件监听函数
        // btn.onclick=function(){
        //     console.log("hello,btn")
        // }

        let box=document.querySelector(".box")
        box.onmouseenter=function(){
            console.log(this)
            this.style.backgroundColor="blue"
        }
        box.onmouseleave=function(){
            console.log("hello,box")
        }        
        let btn=document.querySelector("button")
        btn.onclick=function(){
            box.style.backgroundColor="yellow"
        }
    </script>
</body>
</html>